import Vue from 'vue'
import Router from 'vue-router'

import Main from "../views/Main";
import Login from "../views/Login";

import ProFile from "../views/user/ProFile";
import List from "../views/user/List";
import NotFound from "../views/NotFound";

Vue.use(Router);

export default new Router({
  mode: "history",
  routes: [
    {
      path: '/main/:name',
      component: Main,//嵌套路由
      props: true,
      children: [
        // {path: '/user/profile/:id',
        {path: '/user/profile',
          name: 'ProFile',
          component: ProFile,
          props: true
        },
        {path: '/user/list',
          name: List,
          component: List,
          props: true
        },
      ]
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: 'goHome',
      redirect: '/main'
    },
    {
      path: '*',
      component: NotFound
    }
  ]
});
